package com.yangfan.cloudalibaba.controller;


import com.yangfan.cloudalibaba.service.StorageService;
import com.yangfan.springcloud.entities.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class StorageController {

    @Autowired
    private StorageService storageService;

    @PostMapping(value = "/storage/decreaseStorage")
    public CommonResult decreaseStorage(@RequestParam(value = "productId")Long productId , @RequestParam(value = "count") Integer count){
        storageService.decrease(productId,count);
        return new CommonResult(200,"成功！");
    }

}
